package dk.controller;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ReturnData.ResponseData;

import dk.service.ApiService;

//学生信息控制层
@RestController
@RequestMapping("/api")
public class StudentController {
	@Autowired
	ApiService apiservice;
	@PostMapping("GetStudentListByPage")
	public ResponseData GetStudentListByPage(Integer pagenum,Integer count,String stuname) {
		return apiservice.GetStudentListByPage(pagenum,count,stuname);
	}
	@PostMapping("GetStudentListById")
	public ResponseData GetStudentListById(Integer id) {
		return apiservice.GetStudentListById(id);
	}
	@PostMapping("EditStudentListById")
	public ResponseData EditStudentListById(@RequestBody String studentliststr) throws UnsupportedEncodingException {
		studentliststr = URLDecoder.decode(studentliststr, "utf-8");
		studentliststr = studentliststr.substring(0, studentliststr.length()-1);
		System.out.println(studentliststr);
		return apiservice.EditStudentListById(studentliststr);
	}
	@PostMapping("DelStudentListById")
	public ResponseData DelStudentListById(Integer id) {
		return apiservice.DelStudentListById(id);
	}
	@PostMapping("SendMes")
	public ResponseData SendMes(String phone) {
		return apiservice.SendMes(phone);
	}
	

}
